<template>
	<view class="team">
		<my-s-tabs effect slot-title v-model="activeTab" lineHeight='6' activeColor="#FF7133" lineScale='0.1'
			navPerView="2">
			<my-s-tab v-for="(item, index) of tabList" :key="index">{{ item.name }}</my-s-tab>
		</my-s-tabs>

		<view class="team_box" v-if="activeTab==0">
			<block v-if="list.length">
				<view class="team_list" v-for="item in list" :key="item.id">
					<view class="team_img">

						<image :src="item.avatar"></image>
						<view class="info_name flex-left-right flex-full">
							<view class="team_name flex-column">
								<text> {{item.username}}</text>
								<text> {{item.mobile}}</text>
								<text class="fs-12 gray_font"> {{$fomartDate(item.createtime).substring(0,10)}} </text>
							</view>

							<view>已绑定</view>
						</view>
					</view>
				</view>
			</block>
			<view v-else class="bitmap">
				<image src="/static/img/no_content.png" mode="widthFix"></image>
				<view>暂时没有成员哦~</view>
			</view>

		</view>
		<view class="team_box" v-else>
			
			<block v-if="num>0">
				<view class="team_list" v-for="item in list1" :key="item.id">
					<view class="team_img">

						<image :src="item.avatar"></image>
						<view class="info_name flex-left-right flex-full">
							<view class="team_name flex-column">
								<text> {{item.username}}</text>
								<text> {{item.mobile}}</text>
								<text class="fs-12 gray-font"> {{$fomartDate(item.createtime).substring(0,10)}} </text>
							</view>

							<view>已绑定</view>
						</view>
					</view>
				</view>
			</block>
			<view v-else class="bitmap">
				<image src="/static/img/no_content.png" mode="widthFix"></image>
				<view>暂时没有成员哦~</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabList: [{
						name: '直推',
						id: ''
					},
					{
						name: '间推',
						id: '1'
					},


				],
				activeTab: 0,
				page: 1,
				list: [],
				page1: 1,
				list1: [],
				num:0,
			}
		},
		methods: {
			getList() {
				this.$get(this.$api.dDirectPush, {
					page: this.page
				}, (res) => {
					let {
						data
					} = res;
					if (data.code == 1) {
						this.tabList[0].name = '直推(' + data.data.total + ')';
						this.list = this.list.concat(data.data.data)
					}
				})
			},
			getList1() {
				this.$get(this.$api.dIndirect, {
					page: this.page1
				}, (res) => {
					let {
						data
					} = res;
					if (data.code == 1) {
						let num=data.data.total>0?data.data.total:0;
						this.num=num;
							this.tabList[1].name = '间推(' + num + ')'
						this.list1 = this.list1.concat(data.data.data)
					}
				})
			}
		},
		onLoad() {
			this.getList();
			this.getList1();
		},
		onReachBottom() {
			if (this.activeTab == 0) {
				this.page++;
				this.getList();
			} else {
				this.page1++;
				this.getList1();
			}
		}
	}
</script>

<style scoped>
	.team {
		min-height: 100vh;
		background: white;
	}

	.team_box {
		padding: 0 30rpx;
	}

	.team_list {
		display: flex;
		align-items: center;
		justify-content: space-between;
		height: 140rpx;
		border-bottom: 2rpx solid #eee;
	}

	.team_img {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;

	}

	.info_name {}

	.team_time {
		font-size: 24rpx;
		color: #999;
	}

	.team_img image {
		width: 80rpx;
		height: 80rpx;
		border-radius: 50%;
	}

	.info_time {
		padding-left: 30rpx;
	}

	.team_name {
		font-size: 30rpx;
		color: #333333;
		margin-left: 20rpx;
		/* padding:0 10rpx 0 30rpx; */
	}

	.captain {
		width: 68rpx;
		height: 28rpx;
		border: 1px solid #FF4040;
		border-radius: 14rpx;
		font-size: 22rpx;
		color: #FF4040;
		text-align: center;
		line-height: 28rpx;
	}

	.dissolution {
		width: 146rpx;
		height: 40rpx;
		line-height: 40rpx;
		text-align: center;
		background: #FF4040;
		border-radius: 20rpx;
		color: #fff;
		font-size: 22rpx;
	}

	.remove {
		width: 146rpx;
		height: 40rpx;
		line-height: 40rpx;
		text-align: center;
		background: #FFE048;
		border-radius: 20rpx;
		color: #333;
		font-size: 22rpx;
	}

	.bitmap {
		text-align: center;
		padding-top: 100rpx;
	}

	.bitmap image {
		width: 60%;
	}

	.bitmap view {
		color: gray;
		font-size: 26rpx;
		margin-top: 30rpx;
	}
</style>
